#include <stdio.h>
#define ERROR_VALUE -1

int steps(int start) {
    int steps_taken = 0;
    while (start != 1) {
        steps_taken++;
        if (start <= 0) {
            return ERROR_VALUE;
        }
        printf("Step %d: %d -> ", steps_taken, start);
        if (start % 2 == 0) {
            start = start / 2;
        } else {
            start = 3 * start + 1;
        }
        printf("%d\n", start);
    }
    return steps_taken;
}

int main() {
    int stt;
    printf("Enter an integer >= 1:\n");
    int read = scanf("%d", &stt);
    if (read) {
        int final = steps(stt);
        printf("\n Take totally %d steps!\n", final);
    } else {
        printf("Error reading input!\n");
    }
    return 0;
}
